/*
	Name: 迎接仪式  
	Author: There,hello
	Date: 03-11-19 19:03
	Description: Luogu P1136
	Algorithm: DP
*/
#include <bits/stdc++.h>
using namespace std;
int a[505], f[2][111][111][2], n, m;
char read()
{
	char ch = getchar();
	while (ch != 'j' && ch != 'z')
		ch = getchar();
	return ch;
}
int main()
{
	cin >> n >> m;
	char ch;
	for (int i = 1; i <= n; ++i)
	{
		ch = read();
		if (ch == 'z')
			a[i] = 1;
	}
	memset(f, -0x3f, sizeof(f));
	int t = 1;
	f[0][0][0][1] = 0;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 0; j <= m; ++j)
		{
			for (int k = 0; k <= m; ++k)
			{
				if (a[i])
				{
					if (k)
						f[t][j][k][0] = max(f[t ^ 1][j][k - 1][0], f[t ^ 1][j][k - 1][1]);
					f[t][j][k][1] = max(f[t ^ 1][j][k][0] + 1, f[t ^ 1][j][k][1]);
				}
				else
				{
					if (j)
						f[t][j][k][1] = max(f[t ^ 1][j - 1][k][0] + 1, f[t ^ 1][j - 1][k][1]);
					f[t][j][k][0] = max(f[t ^ 1][j][k][0], f[t ^ 1][j][k][1]);
				}
			}
		}
		t ^= 1;
	}
	t ^= 1;
	int ans = 0;
	for (int i = 0; i <= m; ++i)
		ans = max(ans, max(f[t][i][i][0], f[t][i][i][1]));
	cout << ans;
}